Micron Document
baubs git

Node / mirrors / respira / commits / ded3423

Commit ded3423a19e9a0ca2aa9c239f593cccfcc094a87


Parents : abf7b9a
Author : Jan-Henrik Bruhn <hi@jhbruhn.de>
Date : 2025-12-13T23:48:05+01:00

feature: Add application version to page title

- Read version from package.json at build time using Vite define
- Create global __APP_VERSION__ constant injected by Vite
- Update document title in App component to include version (e.g., "Respira v0.0.0")
- Works reliably in both web and Electron builds

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Changes

3 files changed, 15 insertions(+), 0 deletions(-)


Diff

diff --git a/src/App.tsx b/src/App.tsx
index 6d0bdb6..c2e8c7f 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -15,6 +15,10 @@ import { CheckCircleIcon, BoltIcon, PauseCircleIcon, ExclamationTriangleIcon, Ar
import './App.css';
function App() {
+ // Set page title with version
+ useEffect(() => {
+ document.title = `Respira v${__APP_VERSION__}`;
+ }, []);
// Machine store
const {
isConnected,

diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
new file mode 100644
index 0000000..dbb4c62
--- /dev/null
+++ b/src/vite-env.d.ts
@@ -0,0 +1,3 @@
+/// <reference types="vite/client" />
+
+declare const __APP_VERSION__: string;

diff --git a/vite.config.mts b/vite.config.mts
index 4eae5c6..334ee21 100644
--- a/vite.config.mts
+++ b/vite.config.mts
@@ -4,8 +4,13 @@ import { viteStaticCopy } from 'vite-plugin-static-copy'
import tailwindcss from '@tailwindcss/vite'
import { dirname, join } from 'path'
import { fileURLToPath } from 'url'
+import { readFileSync } from 'fs'
import type { Plugin } from 'vite'
+// Read version from package.json
+const packageJson = JSON.parse(readFileSync('./package.json', 'utf-8'))
+const appVersion = packageJson.version
+
const PYODIDE_EXCLUDE = [
'!**/*.{md,html}',
'!**/*.d.ts',
@@ -133,6 +138,9 @@ export function downloadPyPIWheels(packages: PyPIPackage[]): Plugin {
// https://vite.dev/config/
export default defineConfig({
+ define: {
+ __APP_VERSION__: JSON.stringify(appVersion),
+ },
plugins: [
react(),
tailwindcss(),

Served by rngit 1.4.2 - Generated in 0.04s